/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.ipn.escuela.web.tag;

import java.io.IOException;
import java.util.List;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import mx.ipn.escuela.dao.AlumnoDao;
import mx.ipn.escuela.modelo.Alumno;

/**
 *
 * @author jdmr
 */
public class AlumnoTag extends SimpleTagSupport {

    /**
     * Called by the container to invoke this tag. 
     * The implementation of this method is provided by the tag library developer,
     * and handles all tag processing, body iteration, etc.
     */
    @Override
    public void doTag() throws JspException, IOException {
        AlumnoDao dao = new AlumnoDao();
        List<Alumno> alumnos = dao.lista();
        for (Alumno alumno : alumnos) {
            getJspContext().setAttribute("alumno", alumno);
            getJspBody().invoke(null);
        }
    }
}
